//
//  PutFowardCell.m
//  NewPro
//
//  Created by RYX on 2018/10/16.
//  Copyright © 2018年 何荧红. All rights reserved.
//

#import "PutFowardCell.h"
#import "PutForwardRecordSubModel.h"

@interface PutFowardCell ()
{
    
    __weak IBOutlet UILabel *titleLa;
    __weak IBOutlet UILabel *timeLa;
    __weak IBOutlet UILabel *statueLA;
    __weak IBOutlet UILabel *moneyLa;
    
    __weak IBOutlet UILabel *detailLa;
}


@end

@implementation PutFowardCell

+ (instancetype)tempWithTableView:(UITableView *)tableView{
    
    PutFowardCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CELL"];
    if (!cell) {
        
        ClassName
        cell = [[[NSBundle mainBundle] loadNibNamed:className owner:self options:nil] objectAtIndex:0];
    }
    
    return cell;
}

- (void)setModel:(PutForwardRecordSubModel *)model{
    
    NSString *time = model.date;
    NSMutableAttributedString *timeStr = [[NSMutableAttributedString alloc] initWithString:time attributes:@{NSFontAttributeName: [UIFont fontWithName:@"PingFang-SC-Medium" size: 10],NSForegroundColorAttributeName: [UIColor colorWithRed:102/255.0 green:102/255.0 blue:102/255.0 alpha:1.0]}];
    timeLa.attributedText = timeStr;
    timeLa.textColor = [UIColor colorWithHexString:@"#666666"];
    
    NSString *money = [NSString stringWithFormat:@"%@ 元",model.money];
    NSMutableAttributedString *moneyStr = [[NSMutableAttributedString alloc] initWithString:money attributes:@{NSFontAttributeName: [UIFont fontWithName:@"PingFang-SC-Medium" size: 14],NSForegroundColorAttributeName: [UIColor colorWithRed:102/255.0 green:102/255.0 blue:102/255.0 alpha:1.0]}];
    moneyLa.attributedText = moneyStr;
    moneyLa.textColor = [UIColor colorWithHexString:@"#333333"];
    detailLa.text = @"";
    
    if ([model.type intValue] == 1) {
        
        NSString *title = [NSString stringWithFormat:@"分润提现 - 到%@（%@）",model.carname,[model.carnum substringFromIndex:model.carnum.length - 4]];
        titleLa.text = title;
        
        if ([model.status isEqualToString:@"1"]) {
            
            statueLA.text = @"月结到账";
            statueLA.textColor = [UIColor colorWithHexString:@"#FAB338"];
        }else if([model.status isEqualToString:@"2"]){
            
            statueLA.text = @"提现成功";
            statueLA.textColor = [UIColor colorWithHexString:@"0CA6F0"];
        }else{
            
            statueLA.text = @"提现失败";
            statueLA.textColor = [UIColor colorWithHexString:@"#E52D24"];
            detailLa.text = model.detail;
        }
    }
    
    if ([model.type intValue] == 2) {
        
        NSString *title = [NSString stringWithFormat:@"返现提现 - 到%@（%@）",model.carname,[model.carnum substringFromIndex:model.carnum.length - 4]];
        titleLa.text = title;
        
        if ([model.status isEqualToString:@"1"]) {
            
            statueLA.text = @"处理中";
            statueLA.textColor = [UIColor colorWithHexString:@"#FAB338"];
        }else if([model.status isEqualToString:@"2"]){
            
            statueLA.text = @"提现成功";
            statueLA.textColor = [UIColor colorWithHexString:@"0CA6F0"];
        }else{
            
            statueLA.text = @"提现失败";
            statueLA.textColor = [UIColor colorWithHexString:@"#E52D24"];
            detailLa.text = model.detail;
        }
        
    }
    
    if ([model.type intValue] == 3) {
        
        NSString *title = [NSString stringWithFormat:@"转购机款"];
        titleLa.text = title;
        statueLA.text = @"支付成功";
        detailLa.text = @"";
        statueLA.textColor = [UIColor colorWithHexString:@"0CA6F0"];
        
        if ([model.status isEqualToString:@"1"]) {
            
            statueLA.text = @"处理中";
            statueLA.textColor = [UIColor colorWithHexString:@"#FAB338"];
        }else if([model.status isEqualToString:@"2"]){
            
            statueLA.text = @"支付成功";
            statueLA.textColor = [UIColor colorWithHexString:@"0CA6F0"];
        }else{
            
            statueLA.text = @"已退款";
            statueLA.textColor = [UIColor colorWithHexString:@"#E52D24"];
        }
        
    }
    
    if ([model.type intValue] == 4) {
        
        NSString *title = [NSString stringWithFormat:@"推荐提现 - 到%@（%@）",model.carname,[model.carnum substringFromIndex:model.carnum.length - 4]];
        titleLa.text = title;
        
        if ([model.status isEqualToString:@"1"]) {
            
            statueLA.text = @"处理中";
            statueLA.textColor = [UIColor colorWithHexString:@"#FAB338"];
        }else if([model.status isEqualToString:@"2"]){
            
            statueLA.text = @"提现成功";
            statueLA.textColor = [UIColor colorWithHexString:@"0CA6F0"];
        }else{
            
            statueLA.text = @"提现失败";
            statueLA.textColor = [UIColor colorWithHexString:@"#E52D24"];
            detailLa.text = model.detail;
        }
        
    }
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
